<template>
  <a-spin :spinning="confirmLoading">
 
      <a-form-model ref="formData3" style="max-width: 800px; margin: 30px auto 0;">
        <a-alert
          :closable="true"
          message="请认真填写计费信息，红框必填！"
          style="margin-bottom: 24px;"     />  
        <a-row>
          <a-col :span="12">
            <a-form-model-item label="用水性质" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="natureId">
  	          <j-tree-select
                ref="treeSelect"
                placeholder="请选择用水性质"
                v-model="formData3.natureId"
                dict="mws_t_base_natures,name,id"
                pidValue="0"
                class="inpRequire"
                >
              </j-tree-select>
            </a-form-model-item>
          </a-col> 
          <a-col :span="12">
            <a-form-model-item label="是否计量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isCalculated">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData3.isCalculated" dictCode="yn" placeholder="请选择是否计量" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="是否计费" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isCharged">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData3.isCharged" dictCode="yn" placeholder="请选择是否计费" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="是否预存" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isStored">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData3.isStored" dictCode="yn" placeholder="请选择是否预存" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="是否阶梯" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isTieredPrice">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData3.isTieredPrice" dictCode="yn" placeholder="请选择是否启用阶梯" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="是否增值税" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isVat">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData3.isVat" dictCode="yn" placeholder="请选择是否增值税用户" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="是否预开票" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isPreinvoiced">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData3.isPreinvoiced" dictCode="yn" placeholder="请选择是否预开票户" />
            </a-form-model-item>
          </a-col>
          
        </a-row>
        <a-form-item :wrapperCol="{span: 19, offset: 10}">
          <a-button style="margin-left: 8px" @click="prevStep">上一步</a-button>
          <a-button style="margin-left: 8px" type="primary" @click="nextStep">下一步</a-button>
        </a-form-item>
      </a-form-model>
  </a-spin>
</template>


<script>
  import { httpAction, getAction } from '@/api/manage'
  export default {
    name: "ArcCusStep3",
    props: ["formData3"],
    data () {
      return {
        confirmLoading: false,
        codeStatus: true,
        disabled: {
          type: Boolean,
          default: false,
          required: false
        },

        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        url: {          
          addCusNo: "/arc/arcCustomers/addCusNo",        
        }
      }
    },
    created () {
     
    },
    methods: {
      nextStep () {
        if(this.verifyForm()){
          this.$emit('nextStep')
        }; 
      }, 
      prevStep () {
        this.$emit('prevStep')
      },
      verifyForm(){
        let vrs=true;
        if(! this.formData3.natureId){
          this.$message.warning('请填写片区');
          vrs=false;
        }
        if(! this.formData3.isCalculated){
          this.$message.warning('请选择是否计量');
          vrs=false;
        }
        if(! this.formData3.isCharged){
          this.$message.warning('请选择是否计费');
          vrs=false;
        }
        if(! this.formData3.isStored){
          this.$message.warning('请选择是否预存');
          vrs=false;
        }
        if(! this.formData3.isVat){
          this.$message.warning('请选择是否增值税');
          vrs=false;
        }
        if(! this.formData3.isPreinvoiced){
          this.$message.warning('请选择是否预开票');
          vrs=false;
        }
        if(! this.formData3.isTieredPrice){
          this.$message.warning('请选择是否阶梯');
          vrs=false;
        }
        return vrs; 
      }, 
      addInit(){
        const that = this
        httpAction(this.url.addCusNo,null,'get').then((res)=>{
          if(res.success){         
            
            that.codeStatus=true;
          }else{
            that.$message.warning(res.message);
          }
        }).finally(() => {
          that.confirmLoading = false;
        })
      }    
    }
  }
</script>

<style scoped>

  .inpRequire {
    border: 1px solid #974c4c;
  }

</style>